package c.d.a.a.j;

import android.graphics.Matrix;
import android.graphics.RectF;
import android.view.View;

/* compiled from: ViewPortHandler */
public class h {
    public final Matrix a = new Matrix();
    public RectF b = new RectF();
    public float c = 0.0f;
    public float d = 0.0f;
    public float e = 1.0f;
    public float f = Float.MAX_VALUE;
    public float g = 1.0f;
    public float h = Float.MAX_VALUE;
    public float i = 1.0f;
    public float j = 1.0f;
    public float k = 0.0f;
    public float l = 0.0f;
    public float m = 0.0f;
    public float n = 0.0f;
    public Matrix o = new Matrix();
    public final float[] p = new float[9];

    public void a(float[] fArr, View view) {
        Matrix matrix = this.o;
        matrix.reset();
        matrix.set(this.a);
        float f = fArr[0];
        RectF rectF = this.b;
        matrix.postTranslate(-(f - rectF.left), -(fArr[1] - rectF.top));
        n(matrix, view, true);
    }

    public float b() {
        return this.b.width();
    }

    public boolean c() {
        float f = this.i;
        float f2 = this.g;
        return f <= f2 && f2 <= 1.0f;
    }

    public boolean d() {
        float f = this.j;
        float f2 = this.e;
        return f <= f2 && f2 <= 1.0f;
    }

    public boolean e(float f) {
        return this.b.bottom >= ((float) ((int) (f * 100.0f))) / 100.0f;
    }

    public boolean f(float f) {
        return this.b.left <= f + 1.0f;
    }

    public boolean g(float f) {
        return this.b.right >= (((float) ((int) (f * 100.0f))) / 100.0f) - 1.0f;
    }

    public boolean h(float f) {
        return this.b.top <= f;
    }

    public boolean i(float f) {
        return f(f) && g(f);
    }

    public boolean j(float f) {
        return h(f) && e(f);
    }

    public void k(Matrix matrix, RectF rectF) {
        float height;
        matrix.getValues(this.p);
        float[] fArr = this.p;
        float f = fArr[2];
        float f2 = fArr[0];
        float f3 = fArr[5];
        float f4 = fArr[4];
        this.i = Math.min(Math.max(this.g, f2), this.h);
        this.j = Math.min(Math.max(this.e, f4), this.f);
        f4 = 0.0f;
        if (rectF != null) {
            f4 = rectF.width();
            height = rectF.height();
        } else {
            height = 0.0f;
        }
        this.k = Math.min(Math.max(f, ((this.i - 1.0f) * (-f4)) - this.m), this.m);
        height = Math.max(Math.min(f3, ((this.j - 1.0f) * height) + this.n), -this.n);
        this.l = height;
        fArr = this.p;
        fArr[2] = this.k;
        fArr[0] = this.i;
        fArr[5] = height;
        fArr[4] = this.j;
        matrix.setValues(fArr);
    }

    public float l() {
        return this.d - this.b.bottom;
    }

    public float m() {
        return this.c - this.b.right;
    }

    public Matrix n(Matrix matrix, View view, boolean z) {
        this.a.set(matrix);
        k(this.a, this.b);
        if (z) {
            view.invalidate();
        }
        matrix.set(this.a);
        return matrix;
    }

    public void o(float f, float f2, float f3, float f4) {
        this.b.set(f, f2, this.c - f3, this.d - f4);
    }
}
